package com.jinhongone.pattern.structure.combination;

/*
 * 菜单项：叶子节点角色
 *   作用：叶子节点作为最终节点，没有子菜单
 * */
public class MenuItem extends MenuComponent {

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("-");
        }
        System.out.println(getName());
    }
}
